const aCdnDependencies = [
  // {
  //   name: 'vue',
  //   library: 'Vue',
  //   js: 'https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js',
  //   css: '',
  // },
  // {
  //   name: 'vue-i18n',
  //   library: 'VueI18n',
  //   js: 'https://cdn.jsdelivr.net/npm/vue-i18n@8.15.1/dist/vue-i18n.min.js',
  //   css: '',
  // },
  // {
  //   name: 'vue-router',
  //   library: 'VueRouter',
  //   js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.3/dist/vue-router.min.js',
  //   css: '',
  // },
  // {
  //   name: 'vuex',
  //   library: 'Vuex',
  //   js: 'https://cdn.jsdelivr.net/npm/vuex@3.1.2/dist/vuex.min.js',
  //   css: '',
  // },
  {
    name: 'axios',
    library: 'axios',
    js: 'https://cdn.jsdelivr.net/npm/axios@0.21.1/dist/axios.min.js',
    css: '',
  },
  // {
  //   name: 'better-scroll',
  //   library: 'BScroll',
  //   js: 'https://cdn.jsdelivr.net/npm/better-scroll@1.15.2/dist/bscroll.min.js',
  //   css: '',
  // },
  // {
  //   name: 'axios-mock-adapter',
  //   library: 'AxiosMockAdapter',
  //   js: 'https://cdn.jsdelivr.net/npm/axios-mock-adapter@1.18.1/dist/axios-mock-adapter.min.js',
  //   css: '',
  // },
  // {
  //   name: 'element-ui',
  //   library: 'ELEMENT',
  //   js: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js',
  //   css: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.0/lib/theme-chalk/index.css',
  // },
  {
    name: 'lodash',
    library: '_',
    js: 'https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
    css: '',
  },
  // {
  //   name: 'ua-parser-js',
  //   library: 'UAParser',
  //   js: 'https://cdn.jsdelivr.net/npm/ua-parser-js@0.7.20/dist/ua-parser.min.js',
  //   css: '',
  // },
  {
    name: 'js-cookie',
    library: 'Cookies',
    js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js',
    css: '',
  },
  {
    name: 'nprogress',
    library: 'NProgress',
    js: 'https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
    css: 'https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.css',
  },
  {
    name: 'dayjs',
    library: 'dayjs',
    js: 'https://cdn.jsdelivr.net/npm/dayjs@1.10.4/dayjs.min.js',
    css: '',
  },
  // {
  //   name: 'fuse.js',
  //   library: 'Fuse',
  //   js: 'https://cdn.jsdelivr.net/npm/fuse.js@5.2.3/dist/fuse.min.js',
  //   css: '',
  // },
  // {
  //   name: 'hotkeys-js',
  //   library: 'hotkeys',
  //   js: 'https://cdn.jsdelivr.net/npm/hotkeys-js@3.7.3/dist/hotkeys.min.js',
  //   css: '',
  // },
  // {
  //   name: 'qs',
  //   library: 'Qs',
  //   js: 'https://cdn.jsdelivr.net/npm/qs@6.9.1/dist/qs.js',
  //   css: '',
  // },
  // {
  //   name: 'lowdb',
  //   library: 'low',
  //   js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js',
  //   css: '',
  // },
  // {
  //   name: 'lowdb/adapters/LocalStorage',
  //   library: 'LocalStorage',
  //   js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js',
  //   css: '',
  // },
  {
    name: 'screenfull',
    library: 'screenfull',
    js: 'https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.min.js',
    css: '',
  },
  // {
  //   name: 'sortablejs',
  //   library: 'Sortable',
  //   js: 'https://cdn.jsdelivr.net/npm/sortablejs@1.10.1/Sortable.min.js',
  //   css: '',
  // },
];

module.exports = () => {
  // 设置不参与构建的库
  const externals = {};
  aCdnDependencies.forEach(pkg => {
    externals[pkg.name] = pkg.library;
  });

  // 引入文件的 cdn 链接
  const cdnLink = {
    css: aCdnDependencies.map(e => e.css).filter(e => e),
    js: aCdnDependencies.map(e => e.js).filter(e => e),
  };
  return {
    externals,
    cdnLink,
  };
};
